package cn.drew.basic.config;


import cn.drew.basic.utils.AjaxResult;
import org.springframework.web.bind.annotation.*;

/**
 * controller的增强
 *  全局异常捕获的类
 */
@RestControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler
    public AjaxResult exceptionHandler(Exception e) {
        System.out.println("全局异常捕获>>>:" + e);
        e.printStackTrace();
//        return "全局异常捕获,错误原因>>>"+e.getMessage();
        return AjaxResult.fail();
    }
}
